package com.uflower.order.feign;

import com.uflower.common.utils.R;
import com.uflower.order.to.OrderCreateTo;
import com.uflower.order.to.SkuFullReductionTo;
import com.uflower.order.to.WareSkuReduceTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;

@FeignClient(name = "uflower-product",url = "http://localhost:10001")
public interface ProductFeignService {
    @RequestMapping("product/skuinfo/info/{skuId}")
    public R getSkuInfo(@PathVariable("skuId") Long skuId);

    @GetMapping("product/skusaleattrvalue/{skuId}/saleAttrs")
    List<String> getSkuSaleAttrValues(@PathVariable("skuId") Long skuId);

    @RequestMapping("product/skufullreduction/reduction/{skuId}")
    SkuFullReductionTo getSkuFullReduction(@PathVariable("skuId") Long skuId);

    @GetMapping("product/skuinfo/price/{skuId}")
    BigDecimal getPrice(@PathVariable("skuId") Long skuId);

    @PostMapping("product/skuinfo/hasStock")
    public R getSkusHasStock(@RequestBody List<Long> skuIds);

    @GetMapping("product/skuinfo/fare/{addrId}")
    public R getFare(@PathVariable("addrId") Long addrId);
    @GetMapping("product/spuinfo/bySku/{skuId}")
    R getSpuInfoBySkuId(@PathVariable("skuId") Long skuId);
    @RequestMapping("product/skuinfo/reduceStock")
    R orderReduceStock(@RequestBody WareSkuReduceTo orderCreateTo);

    @RequestMapping("product/brand/info/{brandId}")
    public R getBrandInfoById(@PathVariable("brandId") Long brandId);

}
